<template>
  <div>
    <h2>首页</h2>
    首页的内容
    <br>
    <router-link to='/home/homenews'>新闻</router-link>
    <router-link to='/home/homemessage'>消息</router-link>
   <router-view></router-view>
   
    <input type="text" v-model="message">
  </div>
</template>

<script>
export default {
  name:'home',
  data(){
  return{
    message:'home zz',
    leavePath:''
  }
  },
  created(){
   console.log('最开始创建')
  },
  mounted(){
     
     //document.title = '首页'
  },
  updated(){
    
  },
  //这俩周期函数只有在keep-alive包括时才起作用
  activated(){
     this.$router.replace(this.leavePath)
  },
  destroyed(){
    console.log('销毁了吗')
  },
   beforeRouteLeave (to, from, next) {
    this.leavePath =  this.$route.path
    next()
  }
}
</script>

<style>

</style>